/*
 *  Copyright 2016 http://www.kedacomframework.org
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package com.kedacom.ctsp.authority.service;


import com.kedacom.ctsp.authority.dto.DepartmentImportDTO;
import com.kedacom.ctsp.authority.entity.Department;
import com.kedacom.ctsp.authority.vo.AuthorityImportExcelResultVo;
import com.kedacom.ctsp.web.service.CrudTreeService;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;

/**
 * 部门 服务类
 *
 * @author
 */
public interface DepartmentService extends CrudTreeService<Department, String> {

    /**
     * 获取id的子类
     *
     * @param departmentId
     * @return
     */
    List<Department> getChildren(String... departmentId);

    /**
     * 导入部门
     *
     * @param deptsDtos
     * @return
     */
    List<? extends DepartmentImportDTO> importDepartments(List<? extends DepartmentImportDTO> deptsDtos);

    /**
     * 获取部门和下级部门的code
     *
     * @param departmentId
     * @return
     */
    Set<String> getCascadedDepartmentCodes(String departmentId);

    /**
     * 分管和级联部门
     *
     * @param departmentId
     * @return
     */
    Set<String> getCascadedAndChargedDepartmentCodes(String personId,String departmentId);



    AuthorityImportExcelResultVo importDepartment(MultipartFile file, HttpServletRequest request) throws Exception;

    /**
     * 根据部门编号查询
     *
     * @param code
     * @return
     */
    Department selectByCode(String code);

    List<Department> selectByCode(Set<String> deptCodes);


    Set<String> selectDeptIdByCode(Set<String> deptCodes);
}